﻿// code03040101.cpp : 迭代器
// const_iterator类型

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
    vector<int>::iterator it1;              //it1可读可写元素
    string::iterator it2;                   //it2可读可写字符

    vector<int>::const_iterator it3;        //it3只读元素
    string::const_iterator it4;             //it4只读字符

    const vector<int> v;
    auto it5 = v.begin();                   //因为v是常量，所以it5的类型为vector<int>::const_iterator

    vector<int> v1;
    auto it6=v1.cbegin();                   //因为cbegin是只读类型，所以it6的类型为vector<int>::const_iterator

    return 0;
}

